package com.ruoyi.ssm0116;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@MapperScan("com.ruoyi.ssm0116")
@RestController
@RequestMapping
public class EmpController {

    @Autowired
    EmpMapper empMapper;

    @RequestMapping("/get")
    public Emp get(int id) {
        Emp emp = empMapper.get(id);
        return emp;
    }

    @RequestMapping("/add")
    public int add(Emp emp) {
        int i = empMapper.add(emp);
        return i;
    }

    // 注意：根据id修改其它字段!!!
    @RequestMapping("/update")
    public int update(Emp emp) {
        int i = empMapper.update(emp);
        return i;
    }
}
